<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<div class="preview-container">
	<div class="preview-name preview-item">${treatment.procedure.name}</div>
	<hr/>
	<c:choose>
		<c:when test="${not treatment.isCompleted}">
			<div>
				No preview available.
				<br/><br/><br/>
				<input type="button" value="Mark as completed" onclick="window.location='${url_context}/program-treatment/update.jspx?id=${treatment.id}'"/>
			</div>
		</c:when>
		<c:otherwise>
			<div class="preview-item-header">Description</div>
			<c:choose>
				<c:when test="${not empty treatment.description}">
					<div class="preview-description preview-item">${treatment.description}</div>
				</c:when>
				<c:otherwise>
					<div>No Treatment Description Available</div>
				</c:otherwise>
			</c:choose>	
			<div class="preview-item-header">Result</div>
			<c:choose>
				<c:when test="${not empty treatment.description}">
					<div class="preview-result preview-item"><span class="preview-result-status">${treatment.resultStatus.value}</span> - ${treatment.result}</div>
				</c:when>
				<c:otherwise>
				<div class="preview-result preview-item"><span class="preview-result-status">${treatment.resultStatus.value}</span> - No Result Description Available</div>
				</c:otherwise>
			</c:choose>
			<div class="preview-more"><a href="${url_context}/program-treatment.jspx?id=${treatment.id}">View full details</a></div>
		</c:otherwise>
	</c:choose>
	
</div>
<script type="text/javascript">
	$(document).ready(function(){
		$('.preview-container').fadeIn();
	});

</script>